using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableSystemConfig
	{
		public const string Table = "SystemConfig";
		public const string SystemConfigID = "SystemConfigID";
		public const string ConfigName = "ConfigName";
		public const string ConfigValue = "ConfigValue";
		public const string DBTypeName = "DBTypeName";
		public const string Description = "Description";
	}
	
	[Serializable]
	public class BaseSystemConfig
		: IDbSessionEntity, IJsonClass
	{
		int m_SystemConfigID;
		/// <summary>
        /// 系统配置信息ID(主键)
        /// </summary>
        public int SystemConfigID
        {
            get { return m_SystemConfigID; }
            set { m_SystemConfigID = value; }
        }
		
		string m_ConfigName;
		/// <summary>
        /// 系统配置信息名称
        /// </summary>
        public string ConfigName
        {
            get { return m_ConfigName; }
            set { m_ConfigName = value; }
        }
		
		string m_ConfigValue;
		/// <summary>
        /// 系统配置信息数值
        /// </summary>
        public string ConfigValue
        {
            get { return m_ConfigValue; }
            set { m_ConfigValue = value; }
        }
		
		string m_DBTypeName;
		/// <summary>
        /// 数据类型名称
        /// </summary>
        public string DBTypeName
        {
            get { return m_DBTypeName; }
            set { m_DBTypeName = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 描述
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_SystemConfigID = reader[TableSystemConfig.SystemConfigID];
            m_ConfigName = reader[TableSystemConfig.ConfigName];
            m_ConfigValue = reader[TableSystemConfig.ConfigValue];
            m_DBTypeName = reader[TableSystemConfig.DBTypeName];
            m_Description = reader[TableSystemConfig.Description];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableSystemConfig.SystemConfigID, PrimaryKeyType.Identity, SystemConfigID);
			writer[TableSystemConfig.ConfigName] = ConfigName;
			writer[TableSystemConfig.ConfigValue] = ConfigValue;
			writer[TableSystemConfig.DBTypeName] = DBTypeName;
			writer[TableSystemConfig.Description] = Description;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_SystemConfigID = idd;
        }
		
		public string TableName
        {
            get { return TableSystemConfig.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_SystemConfigID = hashToRead["SystemConfigID"];
			 
             m_ConfigName = hashToRead["ConfigName"];
			 
             m_ConfigValue = hashToRead["ConfigValue"];
			 
             m_DBTypeName = hashToRead["DBTypeName"];
			 
             m_Description = hashToRead["Description"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["SystemConfigID"] = SystemConfigID;
			 
            hashToFill["ConfigName"] = ConfigName;
			 
            hashToFill["ConfigValue"] = ConfigValue;
			 
            hashToFill["DBTypeName"] = DBTypeName;
			 
            hashToFill["Description"] = Description;
			 
        }

        #endregion
		
	}
}
